<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="com.grep.extra.dao.impl.TaskDAOSQL,java.util.*,com.grep.extra.factory.data.impl.TaskUrl"%>
<%
	response.setCharacterEncoding("utf-8");
	String siteid = request.getParameter("siteid");
	TaskDAOSQL taskdao = new TaskDAOSQL();
	List<TaskUrl> listtaskurl = new ArrayList<TaskUrl>();
	
	listtaskurl = taskdao.getTaskBySiteID(siteid);
	
	String responseText = "[";
	for(int i=0;i<listtaskurl.size();i++){
		
		TaskUrl task = new TaskUrl();
		task = listtaskurl.get(i);
		String taskid = task.getId();
		String taskname = task.getTaskName();
		if(i==listtaskurl.size()-1){
			responseText +="{\"taskid\": \""+taskid+"\",\"taskname\": \""+taskname+"\"}";
		}else{
			responseText +="{\"taskid\": \""+taskid+"\",\"taskname\": \""+taskname+"\"},";
		}
	}
	
	responseText += "]";
	response.getWriter().println(responseText);

%>